<!DOCTYPE html>
<html>
<style>
	.div_content
	{
		margin-left: 20%;
	}
</style>
	<head>
		<meta charset="UTF-8">
		<title>发布商品</title>
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
		<script type="text/javascript" src="__PUBLIC__/static/js/jquery.min.js"></script>
		<link rel="stylesheet" href="__PUBLIC__/static/layui/css/layui.css">
		<script src="__PUBLIC__/static/layui/layui.js"></script>
	</head>

	<body>
		<form id="my_form" class="layui-form update_form" action="{:url('accounts/member_add')}" method="post">
			<div class="layui-form-item div_content">
				<label class="layui-form-label">会员编号</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="member_no" lay-verify="required" placeholder="会员编号" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item div_content">
				<label class="layui-form-label">会员名称</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="member_name" lay-verify="required" placeholder="会员名称" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item div_content">
				<label class="layui-form-label">会员电话</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="mobile" lay-verify="required|phone" placeholder="手机号码" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item div_content">
				<label class="layui-form-label">推荐人卡号</label>
				<div class="layui-input-block update_shurk">
					<input type="text" name="recommender_noeq" lay-verify="required" placeholder="推荐人卡号" autocomplete="off" class="layui-input">
				</div>
			</div>
			<div class="layui-form-item div_content">
				<label class="layui-form-label">会员等级</label>
				<div class="layui-input-block" style="float: left; margin-right: 20px; margin-left: 0;">
					<select name="level_id" lay-verify="required">
						<option value=""></option>
						{volist name="user_level" id="vo"}
							<option value="{$vo.id}">{$vo.level_name}</option>
						{/volist}
					</select>
				</div>
			</div>
			<div class="layui-form-item update_btnbox" style="text-align: center;margin-left:unset">
				<div class="layui-input-block" style="    max-width: unset;float: unset;">
					<button type="button" class="layui-btn" lay-submit lay-filter="demo1">立即提交</button>
					<button type="reset" class="layui-btn layui-btn-primary">重置</button>
				</div>
			</div>
		</form>
	</body>
</html>
<script type="text/javascript" src="__PUBLIC__/static/release/wangEditor.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/static/js/assist.js"></script>
<script>
	function set_content(){
  		 $.ajax({
             	type:"post",
                url:"{:url('agent/accounts/member_add')}",
                data: $('#my_form').serialize(),//表单数据
                success:function(data){
                    if(data.code==200){
                    	layer.msg('添加成功', {
						  icon: 1,
						  time: 1500 //2秒关闭（如果不配置，默认是3秒）
						}, function(){
							var index = parent.layer.getFrameIndex(window.name); //获取窗口索引  
					       	parent.layer.close(index); 
						});
                    }else{
                    	layer.msg('添加失败！');//保存成功提示
                    }
                },error:function(data){
                	var a = data;
                }
        });
  	}
	//图片上传
	layui.use(['form'], function(){
  		var $ = layui.jquery,form = layui.form;
  		
		form.on('submit(demo1)', function(data){
			set_content();
		    return false;
		});
		
	})
</script>
